from django.db import models


# Create your models here.


# 创建订单中心表
class OrderCenter(models.Model):
    # id
    status = models.CharField(max_length=5, verbose_name="id")
    # 名称
    name = models.CharField(max_length=10, verbose_name="名称")
    # 图片
    image = models.CharField(max_length=255, verbose_name="图片")
    # 链接地址
    url = models.CharField(max_length=10, verbose_name="链接地址", default='')

    # 配置模型元数据
    class Meta:
        ordering = ["id"]  # 根据id进行排序
        db_table = "order_center"  # 创建的表名
        verbose_name = "订单中心表"  # 当前表的别名
        verbose_name_plural = verbose_name

    def __str__(self):
        return '%s:%s' % (self.id, self.name)


# 创建我的服务表
class MyService(models.Model):
    # id
    ser_id = models.CharField(max_length=5, verbose_name="id")
    # 名称
    name = models.CharField(max_length=10, verbose_name="名称")
    # 图片地址
    pic = models.CharField(max_length=255, verbose_name="图片")
    # 链接地址
    url = models.CharField(max_length=10, verbose_name="链接地址", default='')

    # 配置模型元数据
    class Meta:
        ordering = ["id"]  # 根据id进行排序
        db_table = "my_server"  # 创建的表名
        verbose_name = "订单中心表"  # 当前表的别名
        verbose_name_plural = verbose_name

    def __str__(self):
        return '%s:%s' % (self.id, self.name)


# 创建地址管理表
class Address(models.Model):
    # 用户id
    uid = models.CharField(max_length=255, verbose_name="用户id")
    # 地址id
    address_id = models.CharField(max_length=255, verbose_name="地址id")
    # 收货人
    name = models.CharField(max_length=10, verbose_name="收货人")
    # 手机号
    tel = models.CharField(max_length=12, verbose_name="手机号")
    # 省份
    province = models.CharField(max_length=12, verbose_name="省份")
    # 城市
    city = models.CharField(max_length=12, verbose_name="城市")
    # 地区
    county = models.CharField(max_length=12, verbose_name="地区")
    # 城镇码
    areaCode = models.CharField(max_length=12, verbose_name="城镇码")
    # 城市码
    country = models.CharField(max_length=12, verbose_name="城市码")
    # 详细地址
    addressDetail = models.CharField(max_length=255, verbose_name="详细地址")
    # 是否默认地址
    isDefault = models.CharField(max_length=15, verbose_name="是否默认地址")

    # 配置模型元数据
    class Meta:
        ordering = ["id"]  # 根据id进行排序
        db_table = "user_addr"  # 创建的表名
        verbose_name = "订单中心表"  # 当前表的别名
        verbose_name_plural = verbose_name

    def __str__(self):
        return '%s:%s' % (self.id, self.name)